#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;

class Date
{
    friend istream& operator>>(istream& in, Date& d);
public:
    int GetMonthDay()
    {
        static int day[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 };
        if (_month == 2 && ((_year % 4 == 0 && _year % 100 != 0) || (_year % 400 == 0)))
        {
            return 29;
        }
        else
        {
            return day[_month];
        }
    }

    void days()
    {
        Date tmp(*this);
        int count = 0;
        while (tmp._month > 0)
        {
            --tmp._month;
            if (tmp._month == 0)
                break;
            count += tmp.GetMonthDay();
        }
        count += tmp._day;
        cout << count << endl;
    }
private:
    int _year = 1;
    int _month = 1;
    int _day = 1;
};

istream& operator>>(istream& in, Date& d)
{
    in >> d._year >> d._month >> d._day;
    return in;
}

int main() {
    Date d;
    cin >> d;
    d.days();
}